package Other.Jump;

//55. 跳跃游戏
public class Jump {
    
}



//dp 时间空间优化版本
class Solution {
    public boolean canJump(int[] nums) {
        int len = nums.length;
        // boolean[] dp = new boolean[len];
        // dp[len-1]=true;
        int last = len-1;
        for (int i = len-2; i >=0; i--) {
            int pos = i+nums[i];
            if(pos>=last){
                last = i;
                // dp[i]=true;
            }
        }
        return last==0;
    }
}